from interface import Command

class GreetCommand(Command):
    """
    向用户问好命令类
    """

    @staticmethod
    def get_description():
        return "向用户问好"
    
    @staticmethod
    def get_name():
        return "greet"

    # 解析参数，-n 与 --name 同义
    @staticmethod
    def get_arguments(args):
        """
        解析命令行参数
        :param args: 命令行参数列表
        :return: 参数字典
        """
        arg_config = {
            "name": [True, str],
        }
        short_dict = {
            "n": "name",
        }
        return super().get_arguments(args, short_dict, arg_config)
    
    @staticmethod
    def execute(args):
        """
        执行命令
        :param args: 命令行参数列表
        :return: None
        """
        names = args.get("name")
        for name in names:
            print(f"Hello, {name}!")

